use axum::{extract::{Path, Query}, Json};
use mongodb::options::GridFsBucketOptions;
use serde_json::Value;

use crate::{mdb, code };
// 删除桶
pub async fn index(Path( id ): Path<String>, Query(param): Query<Value>) -> Result<Json<Value>, Json<Value>>{
    let conn = mdb::connect_db_(&param).await?;
    let options = GridFsBucketOptions::builder().bucket_name(id).build();
    let bucket = conn.gridfs_bucket(options);
    code::send_ok(bucket.drop().await)
}